<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
<script>
  function myFunction() {
    if (document.getElementById("dIV").style.display === "block") {
      document.getElementById("dIV").style.display = 'none';
    } else {
      document.getElementById("dIV").style.display = "block"
    }
  }
</script>
</head>
<body>
<button onclick="myFunction()">点我</button>
<div id="dIV">
  这是 DIV 元素。
</div>
</body>
<style>
  #dIV {
    width: 100%;
    padding: 50px 0;
    text-align: center;
    background-color: lightblue;
    margin-top: 20px;
  }
</style>
</html>

